diff --git a/hesk/admin/admin_reply_ticket.php b/hesk/admin/admin_reply_ticket.php index 970d58b..3f454ed 100644 --- a/hesk/admin/admin_reply_ticket.php +++ b/hesk/admin/admin_reply_ticket.php @@ -71,6 +71,9 @@ $message = hesk_input(hesk_POST('message')); // Submit as customer? $submit_as_customer = isset($_POST['submit_as_customer']) ? true : false; +// Load statuses +require_once(HESK_PATH . 'inc/statuses.inc.php'); + if (strlen($message)) { // Save message for later and ignore the rest? @@ -227,45 +230,6 @@ if ($ticket['locked']) { $new_status = 3; } -// -> Submit as: Resolved -elseif ( isset($_POST['submit_as_resolved']) && hesk_checkPermission('can_resolve', 0) ) -{ - $new_status = 3; - - if ($ticket['status'] != $new_status) - { - $revision = sprintf($hesklang['thist3'],hesk_date(),$_SESSION['name'].' ('.$_SESSION['user'].')'); - $sql_status = " , `closedat`=NOW(), `closedby`=".intval($_SESSION['id']).", `history`=CONCAT(`history`,'".hesk_dbEscape($revision)."') "; - - // Lock the ticket if customers are not allowed to reopen tickets - if ($hesk_settings['custopen'] != 1) - { - $sql_status .= " , `locked`='1' "; - } - } -} -// -> Submit as: In Progress -elseif ( isset($_POST['submit_as_in_progress']) ) -{ - $new_status = 4; - - if ($ticket['status'] != $new_status) - { - $revision = sprintf($hesklang['thist9'],hesk_date(),$hesklang['in_progress'],$_SESSION['name'].' ('.$_SESSION['user'].')'); - $sql_status = " , `history`=CONCAT(`history`,'".hesk_dbEscape($revision)."') "; - } -} -// -> Submit as: On Hold -elseif ( isset($_POST['submit_as_on_hold']) ) -{ - $new_status = 5; - - if ($ticket['status'] != $new_status) - { - $revision = sprintf($hesklang['thist9'],hesk_date(),$hesklang['on_hold'],$_SESSION['name'].' ('.$_SESSION['user'].')'); - $sql_status = " , `history`=CONCAT(`history`,'".hesk_dbEscape($revision)."') "; - } -} // -> Submit as Customer reply elseif ($submit_as_customer) { @@ -277,10 +241,53 @@ elseif ($submit_as_customer) $sql_status = " , `history`=CONCAT(`history`,'".hesk_dbEscape($revision)."') "; } } -// -> Default: submit as "Replied by staff" +// -> Submitted with a status change? else { - $new_status = 2; + $submit_as_status = false; + + foreach ($hesk_settings['statuses'] as $id => $data) + { + if ( ! isset($_POST['submit_as-' . $id])) + { + continue; + } + + // "Resolved" status needs special care + if ($id == 3) + { + // Permission to resolve? + if ( ! hesk_checkPermission('can_resolve', 0)) + { + break; + } + + // Lock the ticket if customers are not allowed to reopen tickets + if ($hesk_settings['custopen'] != 1) + { + $sql_status .= " , `locked`='1' "; + } + } + + // Set the new status and log revision if modified + $new_status = $id; + + if ($ticket['status'] != $new_status && $new_status != 2) + { + $revision = sprintf($hesklang['thist9'],hesk_date(),$data['name'],$_SESSION['name'].' ('.$_SESSION['user'].')'); + $sql_status .= " , `history`=CONCAT(`history`,'".hesk_dbEscape($revision)."') "; + } + + $submit_as_status = true; + + break; + } + + // Default: submit as "Replied by staff" + if ( ! $submit_as_status) + { + $new_status = 2; + } } $sql = "UPDATE `".hesk_dbEscape($hesk_settings['db_pfix'])."tickets` SET `status`='{$new_status}',"; diff --git a/hesk/admin/admin_ticket.php b/hesk/admin/admin_ticket.php index 833ed02..2f37d35 100644 --- a/hesk/admin/admin_ticket.php +++ b/hesk/admin/admin_ticket.php @@ -611,23 +611,11 @@ $options = array( ?>
> - -
+ + +
+

@@ -657,6 +645,181 @@ $options = array(

+ +
+ + +
> + +
+
+
+ + + » + +
+ + + +
+
+

+
+
+ ' : ''; + + $att = explode(',', substr($note['attachments'], 0, -1) ); + $num = count($att); + foreach ($att as $myatt) + { + list($att_id, $att_name) = explode('#', $myatt); + + // Can edit and delete note (attachments)? + if ($can_del_notes || $note['who'] == $_SESSION['id']) + { + // If this is the last attachment and no message, show "delete ticket" link + if ($num == 1 && strlen($note['message']) == 0) + { + echo ' + + + + »'; + } + // Show "delete attachment" link + else + { + echo ' + + + + »'; + } + } + + echo ' + + + + + + '.$att_name.'
+ '; + } + } + ?> +
+
+ +
+
+
+ + '; + for ($i=1;$i<=$hesk_settings['attachments']['max_number'];$i++) + { + echo '
'; + } + echo '
'; + } + ?> + + + +
+
+
+ +
+ + + + +
+ +

+ +
+ + + +
+
+ +
+
+
+ +
+ + + +
+
+ +
+
+
+ + +

+
: @@ -931,8 +1094,15 @@ $options = array( +
+
- +  
-
+ @@ -2021,15 +2185,28 @@ function hesk_printReplyForm() { if ( ! $ticket['locked']) { ?> -
@@ -271,7 +271,7 @@ END LICENSE CODE - +